

import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerSocketTest {
	
	
	
	public static void main(String[] args)  throws Exception{
		
		
		ServerSocket  ss = new ServerSocket(8888);
		System.out.println("server start ok...");
		
		Socket socket = null;
		while(true){
			 socket = ss.accept();
			 InputStream is = socket.getInputStream();
			 byte[] b = new byte[1024];
			 
			 int len=0;
			 while( (len=is.read(b)) !=-1){
				 String string  = new String(b,0,len);
				 System.out.print(string);
			 }
			 System.out.println("");
		}	
		
	}

}
